package com.lagou.edu.ad.remote;

import com.lagou.edu.ad.dto.PromotionAdDTO;
import com.lagou.edu.ad.dto.PromotionSpaceDTO;
import com.lagou.edu.common.result.ResponseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "edu-ad-boot", path = "/ad")
public interface AdRemoteService {

    // 获取广告
    @GetMapping("/getAllAds")
    List<PromotionSpaceDTO> getAllAds(@RequestParam("spaceKeys") String[] spaceKeys);

    //根据ID获取对应的广告
    @RequestMapping("/getAdById")
    PromotionAdDTO getAdById(@RequestParam("id") Integer id);

    //获取所有的广告
    @RequestMapping("/getAdList")
    List<PromotionAdDTO> getAdList();

    //获取所有的广告
    @RequestMapping("/updateStatus")
    ResponseDTO updateStatus(@RequestParam("id") Integer id,
                             @RequestParam("status") Integer status);

    //广告位的新增或者修改
    @RequestMapping(value = "/space/saveOrUpdate", method = RequestMethod.POST)
    ResponseDTO saveOrUpdate(@RequestBody PromotionSpaceDTO promotionSpaceDTO);

    //获取单个广告位
    @RequestMapping("/space/getSpaceById")
    PromotionSpaceDTO getPromotionSpaceById(@RequestParam("id") Integer id);

    //获取所有广告位
    @RequestMapping("/space/getAllSpaces")
    List<PromotionSpaceDTO> getAllSpaces();

    //新增或者修改广告信息
    @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
    ResponseDTO saveOrUpdate(@RequestBody PromotionAdDTO promotionAdDTO);

}
